home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.004 / xemacs-1 / xemacs-19.13 / src / cm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-21  |  5.7 KB  |  184 lines

  1. /* Cursor motion calculation definitions for XEmacs
  2.    Copyright (C) 1985, 1989, 1992, 1993 Free Software Foundation, Inc.
  3.  
  4. This file is part of XEmacs.
  5.  
  6. XEmacs is free software; you can redistribute it and/or modify it
  7. under the terms of the GNU General Public License as published by the
  8. Free Software Foundation; either version 2, or (at your option) any
  9. later version.
  10.  
  11. XEmacs is distributed in the hope that it will be useful, but WITHOUT
  12. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14. for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with XEmacs; see the file COPYING.  If not, write to the Free
  18. Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* Synched up with: FSF 19.28. */
  21.  
  22. /* #### Chuck -- This file should be deleted.  I'm not deleting it yet
  23.    because there might be something you want out of it. */
  24.  
  25. #ifndef _XEMACS_CM_H_
  26. #define _XEMACS_CM_H_
  27.  
  28. /* Holds the minimum and maximum costs for the parametrized capabilities.  */
  29. struct parmcap
  30.   {
  31.     int mincost, maxcost;
  32.   };
  33.  
  34. /* This structure holds everything needed to do cursor motion except the pad
  35.    character (PC) and the output speed of the terminal (ospeed), which
  36.    termcap wants in global variables.  */
  37.  
  38. struct cm
  39.   {
  40. #if 0
  41.     /* Cursor position.  -1 in *both* variables means the cursor
  42.        position is unknown, in order to force absolute cursor motion. */
  43.  
  44.     int cm_curY;            /* Current row */
  45.     int cm_curX;            /* Current column */
  46.  
  47.     /* Capabilities from termcap */
  48.     CONST char *cm_up;        /* up (up) */
  49.     CONST char *cm_down;    /* down (do) */
  50.     CONST char *cm_left;    /* left (le) */
  51.     CONST char *cm_right;    /* right (nd) */
  52.     CONST char *cm_home;    /* home (ho) */
  53.     CONST char *cm_cr;        /* carriage return (cr) */
  54.     CONST char *cm_ll;        /* last line (ll) */
  55. #endif /* 0 */
  56.     CONST char *cm_tab;        /* tab (ta) */
  57.     CONST char *cm_backtab;    /* backtab (bt) */
  58. #if 0
  59.     CONST char *cm_abs;        /* absolute (cm) */
  60.     CONST char *cm_habs;    /* horizontal absolute (ch) */
  61.     CONST char *cm_vabs;    /* vertical absolute (cv) */
  62.     CONST char *cm_ds;        /* "don't send" string (ds) */
  63.     CONST char *cm_multiup;    /* multiple up (UP) */
  64.     CONST char *cm_multidown;    /* multiple down (DO) */
  65.     CONST char *cm_multileft;    /* multiple left (LE) */
  66.     CONST char *cm_multiright;    /* multiple right (RI) */
  67.     int cm_cols;        /* number of cols on frame (co) */
  68.     int cm_rows;        /* number of rows on frame (li) */
  69.     int cm_tabwidth;        /* tab width (it) */
  70.     unsigned int cm_autowrap:1;    /* autowrap flag (am) */
  71.     unsigned int cm_magicwrap:1; /* VT-100: cursor stays in last col but
  72.                     will cm_wrap if next char is
  73.                     printing (xn) */
  74.     unsigned int cm_usetabs:1;    /* if set, use tabs */
  75.     unsigned int cm_losewrap:1;    /* if reach right margin, forget cursor
  76.                    location */
  77.     unsigned int cm_autolf:1;    /* \r performs a \r\n (rn) */
  78. #endif
  79.  
  80.     /* Parametrized capabilities.  This needs to be a struct since
  81.        the costs are accessed through pointers.  */
  82.  
  83. #if 0
  84.     struct parmcap cc_abs;    /* absolute (cm) */
  85.     struct parmcap cc_habs;    /* horizontal absolute (ch) */
  86.     struct parmcap cc_vabs;    /* vertical absolute (cv) */
  87.     struct parmcap cc_multiup;    /* multiple up (UP) */
  88.     struct parmcap cc_multidown; /* multiple down (DO) */
  89.     struct parmcap cc_multileft; /* multiple left (LE) */
  90.     struct parmcap cc_multiright; /* multiple right (RI) */
  91. #endif
  92.  
  93. #if 0
  94.     /* Costs for the non-parametrized capabilities */
  95.     int cc_up;            /* cost for up */
  96.     int cc_down;        /* etc. */
  97.     int cc_left;
  98.     int cc_right;
  99.     int cc_home;
  100.     int cc_cr;
  101.     int cc_ll;
  102.     int cc_tab;
  103.     int cc_backtab;
  104.     /* These are temporary, until the code is installed to use the
  105.        struct parmcap fields above.  */
  106.     int cc_abs;
  107.     int cc_habs;
  108.     int cc_vabs;
  109. #endif
  110.   };
  111.  
  112. #if 0
  113. extern struct cm Wcm;        /* Terminal capabilities */
  114. extern char PC;            /* Pad character */
  115.  
  116. /* Shorthand */
  117. #ifndef NoCMShortHand
  118. #define curY        Wcm.cm_curY
  119. #define curX        Wcm.cm_curX
  120. #define Up        Wcm.cm_up
  121. #define Down        Wcm.cm_down
  122. #define Left        Wcm.cm_left
  123. #define Right        Wcm.cm_right
  124. #define Tab        Wcm.cm_tab
  125. #define BackTab        Wcm.cm_backtab
  126. #define TabWidth    Wcm.cm_tabwidth
  127. #define CR        Wcm.cm_cr
  128. #define Home        Wcm.cm_home
  129. #define LastLine    Wcm.cm_ll
  130. #define AbsPosition    Wcm.cm_abs
  131. #define ColPosition    Wcm.cm_habs
  132. #define RowPosition    Wcm.cm_vabs
  133. #define MultiUp        Wcm.cm_multiup
  134. #define MultiDown    Wcm.cm_multidown
  135. #define MultiLeft    Wcm.cm_multileft
  136. #define MultiRight    Wcm.cm_multiright
  137. #define AutoWrap    Wcm.cm_autowrap
  138. #define MagicWrap    Wcm.cm_magicwrap
  139. #define UseTabs        Wcm.cm_usetabs
  140. #define FrameRows    Wcm.cm_rows
  141. #define FrameCols    Wcm.cm_cols
  142.  
  143. #define UpCost        Wcm.cc_up
  144. #define DownCost    Wcm.cc_down
  145. #define LeftCost    Wcm.cc_left
  146. #define RightCost    Wcm.cc_right
  147. #define HomeCost    Wcm.cc_home
  148. #define CRCost        Wcm.cc_cr
  149. #define LastLineCost    Wcm.cc_ll
  150. #define TabCost        Wcm.cc_tab
  151. #define BackTabCost    Wcm.cc_backtab
  152. #define AbsPositionCost    Wcm.cc_abs
  153. #define ColPositionCost    Wcm.cc_habs
  154. #define RowPositionCost    Wcm.cc_vabs
  155. #define MultiUpCost    Wcm.cc_multiup
  156. #define MultiDownCost    Wcm.cc_multidown
  157. #define MultiLeftCost    Wcm.cc_multileft
  158. #define MultiRightCost    Wcm.cc_multiright
  159. #endif
  160. #endif /* 0 */
  161.  
  162. #define cmat(row,col)    (curY = (row), curX = (col))
  163. #define cmplus(n)                    \
  164.   {                            \
  165.     if ((curX += (n)) >= FrameCols && !MagicWrap)    \
  166.       {                            \
  167.     if (Wcm.cm_losewrap) losecursor ();        \
  168.     else if (AutoWrap) curX = 0, curY++;        \
  169.     else curX--;                    \
  170.       }                            \
  171.   }
  172.  
  173. #define losecursor()    (curX = -1, curY = -1)
  174.  
  175. extern int cost;
  176. extern void evalcost (int c);
  177. extern void cmputc (int c);
  178. extern void cmcostinit (void);
  179. extern void cmgoto (int, int);
  180. extern void Wcm_clear (void);
  181. extern int Wcm_init (void);
  182.  
  183. #endif /* _XEMACS_CM_H_ */
  184.